Component({
  data: {
    selected: 0
  },
  methods: {
    onTab(e) {
      const index = e.currentTarget.dataset.index;
      this.setData({ selected: index });
      const map = [
        '/pages/index/index',
        '/pages/circle/circle',
        '/pages/message/message',
        '/pages/mine/mine'
      ];
      const url = map[index];
      if (url) wx.switchTab({ url });
    },
    onPlus() {
      wx.navigateTo({ url: '/pages/circle/publish/publish' });
    }
  }
});
